public class Solution {
    public int[] productExceptSelf(int[] nums) {
        int len = nums.length;
        int[] ret = new int[len];
        ret[0] = 1;
        for(int i = 1;i < len;i++){
            ret[i] = nums[i-1]*ret[i - 1];
        }
        int hou = 1;
        for(int i = len - 1;i >= 0;i--){
            ret[i] = ret[i]*hou;
            hou = hou*nums[i];
        }
        return ret;
    }
}